package snafu.framework.senses;

import java.util.HashSet;
import java.util.Set;

import snafu.framework.senses.perceptions.Perception;
import snafu.framework.senses.perceptions.PerceptionItself;
import snafu.framework.senses.stimuli.Stimulus;
import snafu.framework.view.Access;
import snafu.framework.view.View;

public class SenseView implements View, Sense{

	private Access access;
	private SenseItself sense;
	
	public SenseView(Access access, SenseItself sense) {
		this.access = access;
		this.sense = sense;
	}
	
	@Override
	public Set<Perception> getPerceptableStimuli() {
		Set<Perception> copiedPerceptions = new HashSet<Perception>();
		for (PerceptionItself perception : sense.percetableStimuli) {
			copiedPerceptions.add(perception.createView(access));
		}
		
		return copiedPerceptions;
	}

	@Override
	public boolean canPercept(Stimulus stimulus) {
		return sense.canPercept(stimulus);
	}

}
